OpenMath in SCIEnce: SCSCP and POPCORN

نویسندگان

  • Peter Horn
  • Dan Roozemond
چکیده

In this short communication we want to give an overview of how OpenMath is used in the European project “SCIEnce” [12]. The main aim of this project is to allow unified communication between different computer algebra systems (CASes) or different instances of one CAS. This may involve one or more computers, clusters, and even grids. The main topics are the use of OpenMath to marshal mathematical objects for transport between different CASes, an alternative textual OpenMath representation more suitable for human reading and writing, and finally the publicly released Java Library developed for the project. 1 Marshaling Mathematics in SCSCP When designing a uniform communication interface for Computer Algebra Systems, the first problem that needs to be solved is how to transport the mathematical objects from one system to another. Here, the obvious choice for us was OpenMath [6], since it is a widely used standard with a long history of assisting communication between CASes [1,2]. In this section we briefly comment on the problems faced and the choices made. To simplify the communication between the various CASes, we have developed a protocol called “Symbolic Computation Software Composability Protocol”, abbreviated SCSCP [9,13]. This protocol does not only enable the computation of simple commands in a different system or on a different machine, but it will also serve as a means of conveying constituents of larger, more complex, computations. The protocol is XML-based; in particular, the protocol messages are in the OpenMath language, and its TCP-sockets based implementation uses XML processing instructions to delimit these messages and convey small pieces of information on a higher level. Communication takes place using port 26133, reserved for SCSCP by the Internet Assigned Numbers Authority (IANA). At the moment of writing the protocol has reached version 1.3 and both client and server implementations exist in GAP, KANT, Maple, and MuPAD. The TRIP system also supports the protocol, using their own publicly available implementation of SCSCP [3]. Moreover, we have developed a Java library org.symcomp.scscp J. Carette et al. (Eds.): Calculemus/MKM 2009, LNAI 5625, pp. 474–479, 2009. c © Springer-Verlag Berlin Heidelberg 2009 OpenMath in SCIEnce: SCSCP and POPCORN 475 [14] to facilitate third party developers in exposing their own applications using SCSCP. Apart from two OpenMath Content Dictionaries accompanying the SCSCP protocol [10,11] several other Content Dictionaries were developed in the project, concerning for example efficient matrix representations or polynomial factorization. We expect to submit these to the OpenMath community for consideration in the Summer of 2009. 2 POPCORN – A Tasty OpenMath Representation When handling OpenMath objects, one frequently finds oneself typing and reading lots of OMAs, OMSs, and so on. This may lead one to the conclusion that humans were not designed to parse XML. Therefore, whenever people discuss their experiences with OpenMath, they tend to use more human-readable shortcuts, often inspired by LTEXor a Maple-like syntax. That is why we decided to produce an OpenMath representation taking this into account, and created POPCORN, which is an acronym standing for “Possibly Only Practical Convenient OpenMath Replacement Notation”. For the sake of typographic beauty, we write it as “Popcorn”. We emphasize that Popcorn is merely an OpenMath representation that we consider convenient for humans, similar to the XML representation that is obviously more convenient for machines. Furthermore, if a two-dimensional environment such as a web browser is available, more sophisticated editors such as the MathDox formula editor [5] are even better. However, we still think Popcorn is a valuable addition, e.g. for quick tests, command line applications, etc. Parsing of Popcorn is sufficiently fast for small examples, but for larger OpenMath trees the XML representation can be parsed more efficiently, if only because when parsing Popcorn code an intermediate abstract syntax tree has to be constructed, while such a tree is inherent to the XML representation. The Popcorn language itself not easily user-extensible, but because the Popcorn grammar is included in the libraries, an advanced user may change the grammar, e.g. add infix operators, special symbols, etc, and use it in his or her own application. 2.1 Elementary OpenMath in Popcorn We first look at the notation used for the elementary OpenMath objects. Integers are typed just as one expects: as decimal numbers without whitespace inside or prefixed with 0x in hexadecimal representation; Floats are typed either as, e. g. 2.34e12 or 0f### where the # represent hexcharacters as in the hex attribute of OMF; Strings are wrapped in " or ’ ; References are given either in the simple form #name (for local references ) or the more complex form ##http://somewhere/ something/## (for non-local references); 476 P. Horn and D. Roozemond Variables are whitespace-free strings prefixed with $; Symbols are written as cdname.name. To add an id value to any object, simply postpone it with :theid. 2.2 Compound OpenMath in Popcorn Application is encoded by postponing the parenthesized arguments to the applied object, e. g. arith1.plus(1,2,3); Binding is done by typing square brackets behind the bound object. Within the brackets the comma-separated bound variables are separated from the expression by ->, e. g. quant1.forall[$x, $y -> ...]; Attribution is done by adding key/value-pairs as a comma-separated list in braces to the attributed object, e. g. 1.2{aa.bb -> "cc", "dd" -> 3} 2.3 Syntactically Sugared/Salted Popcorn To allow for more intuitive notation, we added some shortcuts: For the arith1 symbols plus, times, and the relation1 symbols we added the obvious infix symbols +, *, =, <, <=, and so on. The same is true for the logic1 symbols, all with a well-defined operator precedence. For a reasonably large number of frequently used symbols, we decided to get the cdname-free name into the global context, e. g., sum, sin, true, lambda, pi, i, etc. To construct a list1.list, one may simply use square brackets, and to construct set1.set, braces can be used (The Popcorn parser automatically checks whether for example an expression in square brackets matches the binding pattern, so that no confusion arises). Constructing nums1.rational can be done by separating numerator and denominator with //. Similarly nums1.complex cartesian can be constructed by separating the real and imaginary part with |. Also, some of the functionality of the experimental prog1 Content Dictionary is exposed in a Maple-like syntax. 2.4 Popcorn Examples sin(3) 3 lambda[$x->1+$x] 1 OpenMath in SCIEnce: SCSCP and POPCORN 477 $a := [1//2, (2|8):x] 12 28 1.2{aa.bb -> "cc"} cc Here another motivation for the name Popcorn can be seen – it turns something pretty small into something rather giant. 3 org.symcomp.openmath – Convenient Handling of OpenMath with Java For the development of tools and applications within SCIEnce, Java seemed a natural choice because of its portability and the availability of many libraries. Although there are some Java OpenMath Libraries available [7,8], these are older (last update in 2000 and 2004, respectively) and we disagreed with some of the design choices made. We therefore created a new library that takes advantage of the recent developments in Java, such as annotations and generics, and we designed it from the ground up to be as easily extensible as possible. It provides many convenience classes and handy methods to traverse, construct, and analyze OpenMath trees. Furthermore, it has completely transparent support for OpenMath Attributions, eliminating the need to handle these objects in any special way. Import and export to OpenMath 2 XML, OpenMath 2 Binary, and Popcorn are included. Moreover, we have implemented export to LTEX to demonstrate the great extensibility of the library, and because it easily enables rendering of OpenMath in browsers using the well known jsMath package. We expect to include Strict Content MathML 3 soon as well, in view of the recent developments with respect to OpenMath 3. We hope to clarify the simplicity and elegance this library offers by means of the small example in Listing 1.1 (the usual Java preliminaries have been omitted). 3.1 Custom Renderers To feed OpenMath data into other applications, it is often necessary (or at least convenient) to produce a specific format. This is wired into 478 P. Horn and D. Roozemond 1 // Creating an OpenMath application OMSymbol s = new OMSymbol ("somecd", "add"); assert s.isSymbol ("somecd", "add"); OpenMathBase[] params = new OpenMathBase[] { new OMInteger(1), 6 new OMString ("lala") }; OMApply oma = s.apply(params ); assert oma.isApplication(" somecd", "add"); 11 // Creating the same OpenMath object from Popcorn OpenMathBase oma2 = OpenMathBase.parse("somecd.add(1, ’lala ’)"); assert oma.equals(oma2); // Creating an OpenMath object from the XML representation 16 OpenMathBase omi = OpenMathBase.parse("42"); assert omi.deOMObject().isInteger(42); // Creating an OpenMath Binding , using a combination of pure Java // creations and Popcorn. 21 OMVariable[] omvs = new OMVariable[] { new OMVariable("x") }; OMBind ombind = s.bind(omvs , OpenMathBase.parse("$x + 1")); assert ombind.isBinding(s); // Convenient equality testing (note that it is a literal comparison , 26 // e.g. alpha conversion is not included) assert ombind.toPopcorn(). equals("cdname.name[$x -> $x + 1]"); Listing 1.1. Using the org.symcomp.openmath library org.symcomp.openmath as custom renderers. We designed these classes in such a way that producing e. g. a renderer for the Magma language took only a few lines of code. The LTEXand Popcorn-renderer are made using the same mechanism. These also give the user a great starting point for developing his/her own custom renderer.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Easy composition of symbolic computation software using SCSCP: A new Lingua Franca for symbolic computation

We present the results of the first four years of the European research project SCIEnce – Symbolic Computation Infrastructure in Europe (http://www.symbolic-computation.org), which aims to provide key infrastructure for symbolic computation research. A primary outcome of the project is that we have developed a new way of combining computer algebra systems using the Symbolic Computation Software...

متن کامل

Final Report about JRA1 Activity of RISC in the Frame of the SCIEnce Project

In this paper, we report the outcome of our activity in the frame of the JRA1 work package of the SCIEnce project supported by the European Commission Framework 6 Programme. The work in this project is centered around SCSCP protocol which is a remote procedure call framework, in which both protocol messages and data are encoded in the OpenMath. By SCSCP different kinds of computer algebra syste...

متن کامل

Symbolic Computation Software Composability

We present three examples of the composition of Computer Algebra Systems to illustrate the progress on a composability infrastructure as part of the SCIEnce (Symbolic Computation Infrastructure for Europe) project. One of the major results of the project so far is an OpenMath based protocol called SCSCP (Symbolic Computation Software Composability Protocol). SCSCP enables the various software p...

متن کامل

View of Computer Algebra Data from Coq

Data representation is an important aspect of software composition. It is often the case that different software components are programmed to represent data in the ways which are the most appropriate for their problem domains. Sometimes, converting data from one representation to another is a non-trivial task. This is the case with computer algebra systems and type-theory based interactive theo...

متن کامل

Interfacing Coq + SSReflect with GAP

We report on an extendable implementation of the communication interface connecting Coq proof assistant to the computational algebra system GAP using the Symbolic Computation Software Composability Protocol (SCSCP). It allows Coq to issue OpenMath requests to a local or remote GAP instances and represent server responses as Coq terms.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2009